import axios from "./request";
import { IErrorData, ISuccessData } from "./returnData";

export interface IBanner {
    midImg: string,
    bigImg: string,
    title: string,
    description: string,
    id?: string
}

// 获取首页标语
export function getBanner(): Promise<ISuccessData<IBanner> | IErrorData> {
    return axios.get("/api/banner")
}

// 设置首页标语
export function setBanner(banners: IBanner[]): Promise<ISuccessData<IBanner> | IErrorData> {
    console.log(banners)
    // return [] as any;
    return axios.post("/api/banner", banners);
}